<template>
	<view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields"
		:editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions"
		:table="table" :extend="extend">
	</view-grid>
</template>
<script>
import extend from "@/extension/mass/Mass_Incoming.js";
import { ref, defineComponent } from "vue";
export default defineComponent({
	setup() {

		const table = ref({
			key: 'Mass_Incoming_ID',
			footer: "Foots",
			cnName: '来料检验单',
			name: 'Mass_Incoming',
			url: "/Mass_Incoming/",
			sortName: "CreateDate"
		});

		const editFormFields = ref({
			"Mass_Incoming_Name": "",
			"Mass_Incoming_Code": "",
			"Mass_Incoming_ProID": "",
			"Mass_Incoming_ProName": "",
			"Mass_Incoming_ProCode": "",
			"Mass_Incoming_ProModel": "",
			"Mass_Incoming_ReciveNumber": "",
			"Mass_Incoming_CheckNumber": "",
			"Mass_Incoming_DisStandNumber": "",
			"Mass_Incoming_StartDate": "",
			"Mass_Incoming_CheckDate": "",
			"Mass_Incoming_Result": "",
			"Mass_Incoming_Remark": ""
		});

		const columns = ref([
			{ field: 'Mass_Incoming_ID', title: '来料检验单主键', type: 'int', width: 110, hidden: true, readonly: true, require: true, align: 'left' },
			{ field: 'Mass_Incoming_Name', title: '检验单名称', type: 'string', link: true, width: 120, require: true, align: 'left', sort: true },
			{ field: 'Mass_Incoming_Code', title: '检验单编码', type: 'string', width: 120, align: 'left', required: false, placeholder: "如果为空，则自动生成编码" },
			{ field: 'Mass_Incoming_ProID', title: '产品', type: 'int', width: 110, hidden: true, readonly: true, require: true, align: 'left' },
			{ field: 'Mass_Incoming_ProName', title: '产品名称', type: 'string', width: 120, readonly: true, require: true, align: 'left' },
			{ field: 'Mass_Incoming_ProCode', title: '产品编码', type: 'string', width: 120, readonly: true, require: true, align: 'left' },
			{ field: 'Mass_Incoming_ProModel', title: '规格型号', type: 'string', width: 180, readonly: true, align: 'left' },
			{ field: 'Mass_Incoming_ReciveNumber', title: '本次接收数量', type: 'int', width: 110, require: true, align: 'left' },
			{ field: 'Mass_Incoming_CheckNumber', title: '本次检验数量', type: 'int', width: 110, require: true, align: 'left' },
			{ field: 'Mass_Incoming_DisStandNumber', title: '不合格数量', type: 'int', width: 110, align: 'left' },
			{ field: 'Mass_Incoming_StartDate', title: '来料日期', type: 'date', width: 110, require: true, align: 'left' },
			{ field: 'Mass_Incoming_CheckDate', title: '检测日期', type: 'date', width: 110, require: true, align: 'left' },
			{ field: 'Mass_Incoming_Result', title: '检测结果', type: 'string', bind: { key: 'QcResult', data: [] }, width: 120, require: true, align: 'left' },
			{ field: 'Mass_Incoming_Remark', title: '备注', type: 'string', width: 220, align: 'left' },
			{ field: 'CreateID', title: '创建人编号', type: 'int', width: 80, hidden: true, align: 'left' },
			{ field: 'Creator', title: '创建人', type: 'string', width: 130, align: 'left' },
			{ field: 'CreateDate', title: '创建时间', type: 'datetime', width: 110, align: 'left', sort: true },
			{ field: 'ModifyID', title: '修改人编号', type: 'int', width: 80, hidden: true, align: 'left' },
			{ field: 'Modifier', title: '修改人', type: 'string', width: 130, align: 'left' },
			{ field: 'ModifyDate', title: '修改时间', type: 'datetime', width: 110, align: 'left', sort: true }
		]);

		const detail = ref({
			cnName: "来料检验单-检验项",
			table: "Mass_Incoming_DetItems",
			columns: [
				{ field: 'Mass_Incoming_DetItems_ID', title: '来料检验单检测项主键', type: 'int', width: 110, hidden: true, require: true, align: 'left' },
				{ field: 'Mass_Incoming_DetItems_coming_ID', title: '来料检验单主键', type: 'int', width: 110, hidden: true, require: true, align: 'left' },
				{ field: 'Mass_Incoming_DetItems_DetTem_ItemID', title: '检验模版检验项主键', type: 'int', width: 110, hidden: true, readonly: true, require: true, align: 'left' },
				{ field: 'Mass_Incoming_DetItems_DetTemID', title: '模版主键', type: 'int', width: 110, hidden: true, require: true, align: 'left' },
				{ field: 'Mass_Incoming_DetItems_DetItemsID', title: '检测项主键', type: 'int', width: 110, hidden: true, require: true, align: 'left' },
				{ field: 'Mass_Incoming_DetItems_DetItemsName', title: '检测项名称', type: 'string', width: 120, align: 'left', sort: true },
				{ field: 'Mass_Incoming_DetItems_DetItemsCode', title: '检测项编码', type: 'string', width: 120, align: 'left', required: false },	
				{ field: 'Mass_Incoming_DetItems_DetItemsType', title: '检测项类型', type: 'string', bind: { key: 'QCDefectType', data: [] }, width: 180, align: 'left' },
				{ field: 'Mass_Incoming_DetItems_DetItemsTool', title: '检测工具', type: 'string', width: 180, align: 'left' },
				{ field: 'Mass_Incoming_DetItems_DetItemsRequire', title: '检测要求', type: 'string', width: 180, align: 'left' },
				{ field: 'Mass_Incoming_DetItems_DetItemsStandardValue', title: '标准值', type: 'decimal', width: 110, align: 'left' },
				{ field: 'Mass_Incoming_DetItems_DetItemsErrorUp', title: '误差上限', type: 'decimal', width: 110, align: 'left' },
				{ field: 'Mass_Incoming_DetItems_DetItemsErrorDown', title: '误差下限', type: 'decimal', width: 110, align: 'left' },
				{ field: 'Mass_Incoming_DetItems_FatelNum', title: '致命缺陷数量', type: 'int', width: 110, edit: { type: 'number' }, align: 'left' },
				{ field: 'Mass_Incoming_DetItems_SevereNum', title: '严重缺陷数量', type: 'int', width: 110, edit: { type: 'number' }, align: 'left' },
				{ field: 'Mass_Incoming_DetItems_SlightNum', title: '轻微缺陷数量', type: 'int', width: 110, edit: { type: 'number' }, align: 'left' },
				{ field: 'Mass_Incoming_DetItems_Remark', title: '备注', type: 'string', width: 220, edit: { type: 'text' }, align: 'left' },
				{ field: 'CreateID', title: '创建人编号', type: 'int', width: 80, hidden: true, align: 'left' },
				{ field: 'Creator', title: '创建人', type: 'string', width: 130, align: 'left' },
				{ field: 'CreateDate', title: '创建时间', type: 'datetime', width: 110, align: 'left', sort: true },
				{ field: 'ModifyID', title: '修改人编号', type: 'int', width: 80, hidden: true, align: 'left' },
				{ field: 'Modifier', title: '修改人', type: 'string', width: 130, hidden: true, align: 'left' },
				{ field: 'ModifyDate', title: '修改时间', type: 'datetime', width: 110, hidden: true, align: 'left', sort: true }
			],
			sortName: "Mass_Incoming_DetItems_ID",
			key: "Mass_Incoming_DetItems_ID"
		});


		const editFormOptions = ref([
			[
				{ "title": "检验单名称", "required": true, "field": "Mass_Incoming_Name", "colSize": 6, "type": "text" },
				{ "title": "检验单编码", "field": "Mass_Incoming_Code", type: "text", placeholder: "编码若为空，则自动生成编码", colSize: 6, required: false },
			],
			[
				{ "title": "产品", "required": true, "field": "Mass_Incoming_ProID", "disabled": true, "type": "number" },
				{ "title": "产品名称", "required": true, "field": "Mass_Incoming_ProName", "disabled": true },
				{ "title": "产品编码", "required": true, "field": "Mass_Incoming_ProCode", "disabled": true },
			],
			[
				{ "title": "规格型号", "field": "Mass_Incoming_ProModel", "disabled": true },
				{ "title": "本次接收数量", "required": true, "field": "Mass_Incoming_ReciveNumber", "type": "number" },
			],
			[
				{ "title": "本次检验数量", "required": true, "field": "Mass_Incoming_CheckNumber", "type": "number" },
				{ "title": "不合格数量", "field": "Mass_Incoming_DisStandNumber", "type": "number" },
			],
			[
				{ "title": "来料日期", "required": true, "field": "Mass_Incoming_StartDate", "type": "date" },
				{ "title": "检测日期", "required": true, "field": "Mass_Incoming_CheckDate", "type": "date" },
			],
			[
				{ "dataKey": "QcResult", "data": [], "title": "检测结果", "required": true, "field": "Mass_Incoming_Result", "type": "select" },
				{ "title": "备注", "field": "Mass_Incoming_Remark", "colSize": 6, "type": "textarea" }
			]
		]);



		const searchFormFields = ref(
			{
				"InComingCheckName": "",
				"InComingCheckCode": "",
				"ProductName": "",
				"ProductCode": "",
				"ProductStandard": "",
				"ReciveNumber": [null, null],
				"CheckNumber": [null, null],
				"DisStandNumber": [null, null],
				"InComingDate": "",
				"CheckDate": "",
				"Result": "",
				"Remark": ""
			});



		const searchFormOptions = ref([
			[
				{ "title": "检验单名称", "field": "InComingCheckName", "type": "like" },
				{ "title": "检验单编码", "field": "InComingCheckCode", "type": "like" },
				{ "title": "产品名称", "field": "ProductName", "type": "like" }
			],
			[
				{ "title": "产品编码", "field": "ProductCode", "type": "like" },
				{ "title": "规格型号", "field": "ProductStandard", "type": "like" },
				{ "title": "本次接收数量", "field": "ReciveNumber", "type": "range" }
			],
			[
				{ "title": "本次检验数量", "field": "CheckNumber", "type": "range" },
				{ "title": "不合格数量", "field": "DisStandNumber", "type": "range" },
				{ "title": "来料日期", "field": "InComingDate", "type": "date" }
			],
			[
				{ "title": "检测日期", "field": "CheckDate", "type": "date" },
				{ "dataKey": "QcResult", "data": [], "title": "检测结果", "field": "Result", "type": "select" },
				{ "title": "备注", "field": "Remark", "type": "like" }
			]
		]);


		return {
			table,
			extend,
			editFormFields,
			editFormOptions,
			searchFormFields,
			searchFormOptions,
			columns,
			detail,
		};
	},
});
</script>
